<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title></title>
<link rel="stylesheet" href="${staticServer}/inc/style/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/style/page.css" />
<link rel="stylesheet" href="${staticServer}/css/struct_info.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/infopad.js?2.2"></script>
	
<link rel="stylesheet" href="${staticServer}/inc/style/date/datepicker.css" />
<script src="${staticServer}/inc/js/datepicker.js"></script>

<style>
#SWFUpload_0{
	margin-top: 70px;
    margin-left: -30px;
}
</style>
<script>
var contextPath='${contextPath}';
var _contextPath = '${staticServer}';

var addTravel = function(){
	var dj_name = $("#dj_name").val();
	var center = $("#center").val();
	var name = $("#name").val();
	var phone = $("#phone").val();
	var reason = $("#reason").val();
	var type = $("#type").val();
	if(phone==""){
		infopad.err("黑名人的电话不能为空");
		return;
	}
	if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(phone))){ 
        infopad.err("手机号码格式不正确");
    	return;
    } 
	$.post("${contextPath}/index/save_blackphone.json", {
			"dj_name":dj_name,
			"center":center,
			"name":name,
			"phone":phone,
			"reason":reason,
			"type":type
		}, function(ms) {
		    var msg = ms.msg;
		    if(msg!=null && msg=="1"){
				infopad.msg("添加成功！");
				window.location.href="${contextPath}/index/blackphone.htm?type="+ms.type;
		    }else{
		    	infopad.err("操作失败，请联系管理员！");
		    }
			
	});
};

</script>
</head>
<input type="hidden" id="id" value="<#if travel??>${travel.id}</#if>">
<body>
	<div id="home_link">
		<ul>
			<li>工作管理</li>
			<li>&gt;</li>
			<li>竞思黑名单</li>
			<li>&gt;</li>
			<li class="current">添加黑名单</li>
		</ul>
	</div>

	<div id="container">
		<div id="title">添加黑名单</div>
		<table id="infotable">
			
			<tr>
				<th>录入人:</th>
				<td>
					<input type="text" id="dj_name" size="30" value="">
				</td>
			</tr>
			<tr>
				<th>录入人所属中心:</th>
				<td>
					<input type="text" id="center" size="30" value="">
				</td>
			</tr>
			<tr>
				<th>黑名人:</th>
				<td>
					<input type="text" id="name" size="30" value="">
				</td>
			</tr>
			<tr>
				<th>黑名人电话:</th>
				<td>
					<input type="text" id="phone" size="30" value=""
						onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();">
				</td>
			</tr>
			<tr>
				<th>原因:</th>
				<td>
					<input type="text" id="reason" size="30" value="">
				</td>
			</tr>
			<tr>
				<th>内部/外部:</th>
				<td>
					<select id="type">
						<option value="">请选择</option>
						<option value="1">内部</option>
						<option value="2">外部</option>
					</select>
				</td>
			</tr>
		</table>
		<div id="controlbar">
			<input type="button" class="submit" onclick="addTravel()" value="  保  存  " />
		</div>
	</div>
	
</body>
</html>